package com.zzyl.config;


import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import org.springframework.beans.factory.annotation.Autowired;
import com.zzyl.properties.AliIoTConfigProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlilotConfig {

    @Autowired
    private AliIoTConfigProperties aliOssConfigProperties;

    @Bean
    public Client AliIotClient() throws Exception {
        Config config = new Config();
        config.setAccessKeyId(aliOssConfigProperties.getAccessKeyId());
        config.setAccessKeySecret(aliOssConfigProperties.getAccessKeySecret());
        config.setRegionId(aliOssConfigProperties.getRegionId());
        return new Client(config);
    }

}
